/*
	选择组件--科目选择用事件程序
*/
function elementLeft(e){
	var offset = e.offsetLeft;
	if(e.offsetParent != null) offset += elementLeft(e.offsetParent);
	return offset;
}

function elementTop(e){
	var offset=e.offsetTop;
	if(e.offsetParent != null) offset += elementTop(e.offsetParent);
	return offset;
}


function openTree(varDivId,type,wUrl,e){
var x = elementLeft(e);
var y = elementTop(e)+24;
var divTemp = "";
var stringUrl = wUrl;
var id = wUrl.substring(wUrl.indexOf("?iid=")+5,wUrl.indexOf("&iname="));
var name = wUrl.substring(wUrl.indexOf("&iname=")+7);
 divTemp =  divTemp + "<table border=0 cellpadding=0 cellspacing=0 style=\"border:1px solid #023988\"> ";
divTemp =  divTemp + " <tr><td align=left valign=top bgcolor=#EFEFEF>";
divTemp = divTemp + "<iframe src='"+wUrl+"&type="+type+"'  width='260' height='350' scrolling='no'   frameborder='0' ></iframe>";
divTemp = divTemp + "</td></tr>";
divTemp = divTemp + "<tr><td align='right' ><input type='button' value='清 除'  onclick=\"cleanValue('"+id+"','"+name+"')\"/>&nbsp;&nbsp;<input type='button' value='关 闭'  onclick=\"closeDiv('"+varDivId+"')\"/>&nbsp;</td></tr>";
divTemp = divTemp + "</table>";
document.getElementById(varDivId).innerHTML = divTemp;
	document.getElementById(varDivId).style.display="";
	document.getElementById(varDivId).style.left = x+"px";
	document.getElementById(varDivId).style.top = y+"px";
}
function cleanValue(id,name){
	document.getElementById(id).value="";
	document.getElementById(name).value="";
}
function openTreeCom(varDivId,type,wUrl,e,roleName){
var x = elementLeft(e);
var y = elementTop(e)+24;
var divTemp = "";
 divTemp =  divTemp + "<table border=0 cellpadding=0 cellspacing=0 style=\"border:1px solid #023988\"> ";
divTemp =  divTemp + " <tr><td align=left valign=top bgcolor=#EFEFEF>";
divTemp = divTemp + "<iframe src='"+wUrl+"&type="+type+"&roleName="+roleName+"'  width='260' height='350' scrolling='no'   frameborder='0' ></iframe>";
divTemp = divTemp + "</td></tr>";
divTemp = divTemp + "<tr><td align='right' ><input type='button' value='关 闭'  onclick=\"closeDiv('"+varDivId+"')\"/>&nbsp;</td></tr>";
divTemp = divTemp + "</table>";
document.getElementById(varDivId).innerHTML = divTemp;
	document.getElementById(varDivId).style.display="";
	document.getElementById(varDivId).style.left = x+"px";
	document.getElementById(varDivId).style.top = y+"px";
}
function closeDiv(varDivId){
	document.getElementById(varDivId).innerHTML = "";
	document.getElementById(varDivId).style.display="none";
}
function clearValue(id1,id2){
	document.getElementById(id1).value="";
	document.getElementById(id2).value="";
}